/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lolbatfsm.io;

import java.util.ArrayList;
import java.util.Collection;
import lolbatfsm.system.AsynchronousTransition;
import lolbatfsm.system.SynchronousTransition;

/**
 * This interface must be implemented in order to control the evolution of a simulation
 * by selecting which transition(s) to trigger when asked by the Simulator (at the beginning
 * of each iteration).
 * @author Matteo Battaglio <madbat87@gmail.com>
 */
public interface SimulationController {

    /**
     * Allows the simulation controller to select the transitions to trigger among the enabled ones.<br>
     * Each element of the <code>selectableAsyncTransitions</code> list is an asynchronous transition
     * enabled to trigger;<br>
     * Each element of the <code>selectableSyncTransitions</code> list is a collection of
     * reciprocally-synchronous transitions enabled to trigger together.
     * It must return a 2-dimensional int array having at index 0 the array of indices
     * of the selected asynchronous transitions among <code>selectableAsyncTransitions</code>,
     * and at index 1 the array of indices of the selected collections of synchronous transitions
     * among <code>selectableSyncTransitions</code>.
     *
     * @param selectableAsyncTransitions the list of asynchronous transitions enabled to trigger.
     * @param selectableSyncTransitions the list of groups of reciprocally-synchronous transitions
     * enabled to trigger together.
     * @param allowNullSelection tells the simulation controller if a null selection is allowed.
     * @return a 2-dimensional int array having at index 0 the array of indices
     * of the selected asynchronous transitions among <code>selectableAsyncTransitions</code>,
     * and at index 1 the array of indices of the selected collections of synchronous transitions
     * among <code>selectableSyncTransitions</code>.
     */
    Integer[][] selectTransitions(ArrayList<AsynchronousTransition> selectableAsyncTransitions,
                                           ArrayList<? extends Collection<SynchronousTransition>> selectableSyncTransitions,
                                           boolean allowNullSelection);

}
